<?php
header('Cache-control: private'); // IE 6 FIX
if(isSet($_GET['lang']))
{		
$lang = $_GET['lang'];

// register the session and set the cookie
$_SESSION['lang'] = $lang;

setcookie("lang", $lang, time() + (3600 * 24 * 30));
}
else if(isSet($_SESSION['lang']))
{
$lang = $_SESSION['lang'];
}
else if(isSet($_COOKIE['lang']))
{
$lang = $_COOKIE['lang'];
}
else
{
if(!empty($_GET["decode"]))
    {
    $de = $_GET["decode"];
    $de = rtrim($de, '/');
    $de = explode('/', $de);
        $wseller        = "com.`shorturl`='".$de[0]."'"; //line 852 in comment-funt.php
        $getseller      = new seller();
        $seller_all     = $getseller->sellers($wseller);
        $seller_row     = @mysql_fetch_assoc($seller_all);
        $lang = $seller_row['language'];
    }
    else
    {
        $lang = 'en';
    }    
}

switch ($lang) {
  case 'en':
  $lang_file = 'lang.en.php';
  break;

  case 'km':
  $lang_file = 'lang.km.php';
  break;
  
  case 'de':
  $lang_file = 'lang.de.php';
  break;

  case 'es':
  $lang_file = 'lang.es.php';
  break;

  default:
  $lang_file = 'lang.en.php';

}
include_once S_ROOT.'/languages/'.$lang_file;
?>